function DataFind(servicep){
	this.service = servicep;
	InputTextDouble.apply(this,[""]);
	this.setIcon("search");
	this.setIcon("repeat",2);  
	this.htmlX.addClass("DataFind");
	this.htmlX.find(".inputtt").attr('data-value','');
	this.htmlX.find(".addon2").click($.proxy(this.reloadService,this));
	this.puid="";
	this.htmlX[0]["dta"] = this;
}
DataFind.prototype = Object.create(InputTextDouble.prototype);
DataFind.prototype.constructor = DataFind;

DataFind.prototype.getValue = function(){	
	var vl = this.htmlX.find(".inputtt").attr('data-value');
	return vl;
};
DataFind.prototype.setValue = function(vl){	
	var desc = "";
	var tmpS = ServicesSingleTone.getServiceByDesc(this.service); 
	var rrs = tmpS.findItemById(vl);
	if(rrs!=null){
		desc = rrs[tmpS.descAlias];
	};	
	this.htmlX.find(".inputtt").attr('data-value', vl).val(desc);
};
DataFind.prototype.getDesc = function(){	
	return this.htmlX.find('.itFindByDesc option:selected').text(); 
};
DataFind.prototype.setDesc = function(vld){	
	this.htmlX.find('.itFindByDesc option:selected').text(vld);
};

DataFind.prototype.setDataProviderByService = function(tmpService){	
	this.htmlX.find(".inputtt").typeahead({'itemSelected': function(item) {
        //$(this).val('').val(item.val);           
        var campoDisplay = this.display;             
        var texto = item[0].innerText || item[0].textContent;
        texto = texto.replace(/^\s+|\s+$/g,"");
        var ind = this.source.busca(campoDisplay,texto);
        if(ind>-1){
        	 var campoId = this.val; 
        	 var itemS = this.source[ind][campoId];
        	$("#inputIcon_"+this.idDataFind).attr('data-value',itemS);
        }        
    },'idDataFind':this.uid,'source': tmpService.dataProvider,'val':tmpService.idAlias,'display':tmpService.descAlias});
};
DataFind.prototype.reloadService = function(){
	var tmpService = ServicesSingleTone.getServiceByDesc(this.service);
	tmpService.load(this.uid,this.puid);
};
DataFind.prototype.loadServiceOnce = function(puid){   	
	if(this.puid==""){
		this.puid = puid;
	}
    ServicesSingleTone.getServiceByDesc(this.service).loadOnce(this.uid,this.puid);
};

DataFind.prototype.findById = function(){
	$(this).parent(".DataFind").find(".itFindByDesc").val(this.value);
};
